Air Pollution Data Reading Service communication driver is the driver to communicate with Air Korea, of KECO, for read air pollution information data.
Reference) Please get the service key for your account at Public Data Portal (data.go.kr) before using Air Pollution Data Reading Service communication driver.
<Figure 1> is read setting example of Air Pollution Data Reading Service communication driver.
![]() |
<Figure 1> Read setting example of Air Pollution Data Reading Service communication driver |
Please input Device setting of <Figure 1> Connection type( TCP/IP ), IP address of the site( apis.data.go.kr ), TCP service port( fixed to 80 ) respectively.
In protocol option part, you can set the following: interval of each read schedule(0 ~ 36000 sec, default = 180), designated Buffer interval(35 ~ 200, default = 50), Reconnection Every Read Request option ( 1 = Enabled, 0 = Disabled, default = 1 ). Each argument is a comma-delimited( , ).
Air Pollution Data Reading Service communication driver read schedule
Read schedule setting parameters are as follows
1) Station address – don't care.
2) Read Command –Write Reading Point name in Korean designated in Air Quality data service. (ref: https://www.airkorea.or.kr/web/stationInfo?pMENU_NO=93 )
3) Read Start Address – don't care.
4) Save start address for Communication Server - Saving start address of Communication Server.
5) Read Size – The number of data to read at a time.(1 ~ 100).
Read schedule example)
READ, 0, »ó´ë¿øµ¿, 0, 0, 1,
<Table 1> is a data saving address and contents, and <Table 2> is a flag status value for Air Pollution Data Reading Service
Stored Values |
Contents |
Start Add + 0 : communication status | 1 = normal, 0 = error |
Start Add + 1 : number of load | 1 ~ = normal (norm 22 ~ 23), 0 = station name error |
Start Add + 2 : response code | 0 = normal, etc = error |
Start Add + 3 ~ 5 : Year, Month, Day of measurement | |
Start Add + 6 ~ 7 : Hour and Minute of measurement | |
Start Add + 8 : Reading Point name | Refer to String memory |
Start Add + 9 : Reading Point code | expressed in number |
Start Add + 10 : Reading Point information | 1 = urban, 2 = roadside, 3 = national background, 4 = rural, 5 - port, 0 =etc |
Start Add + 11 : concentration of so2 Start Add + 12 : concentration of co Start Add + 13 : concentration of o3 Start Add + 14 : concentration no2 |
concentration of so2(refer to float, double memory) concentration of co(refer to float, double memory) concentration of o3(refer to float, double memory) concentration no2(refer to float, double memory) |
Start Add + 15 : concentration of pm10 Start Add + 16 : 24hr prediction moving average of pm10 |
concentration of pm10 |
Start Add + 17 : concentration of pm25 Start Add + 18 : 24hr prediction moving average of pm25 |
concentration of pm25 |
Start Add + 19 : khai value Start Add + 20 : khai grade |
(CAI value, Comprehensive air-quality index) (CAI grade, Comprehensive air-quality index) |
Start Add + 21 : so2 grade Start Add + 22 : co grade Start Add + 23 : o3 grade Start Add + 24 : no2 grade |
so2 grade co grade o3 grade no2 grade |
Start Add + 25 : pm10 grade Start Add + 26 : pm25 grade |
pm10 grade for 24 hours pm25 grade for 24 hours |
Start Add + 27 : pm10 grade 1h Start Add + 28 : pm25 grade 1h |
pm10 grade for 1 hour pm25 grade for 1 hour |
Start Add + 29 : so2 flag Start Add + 30 : co flag Start Add + 31 : o3 flag Start Add + 32 : no2 flag |
so2 flag(Refer to <Table 2>) co flag(Refer to <Table 2>) o3 flag(Refer to <Table 2>) no2 flag(Refer to <Table 2>) |
Start Add + 33 : pm10 flag Start Add + 34 : pm25 flag |
pm10 flag(Refer to <Table 2>) pm25 flag(Refer to <Table 2>) |
Start Add + designated Buffer interval + 0 ~ 2 : Year, Month, Day of
measurement Start Add + designated Buffer interval + 3 ~ 4 : Hour and Minute of measurement Start Add + designated Buffer interval + 5 : Reading Point name ... |
|
<Table 1> Stored values and save contents of Air Pollution Data Reading Service communication driver |
flag Values |
Contents |
1 2 3 4 5 6 0 |
null measured data check / calibration out of service data error communication error etc |
<Table 2> values and contents of flag |
Air Pollution Data Reading Service communication driver stores the same data in WORD, DWORD, FLOAT, DOUBLE, STRING memory, but the data formats are different.
If you click the icon
in
protocol option part, you can see the dialogue box such as <Figure 2>. you
can also set read schedule by using this part.
![]() |
<Figure 2> Example of Air Pollution Data Reading Service communication driver¡¯s Option dialog box |
You can also set read schedule by using
,
,
button
and listbox of <Figure 2>. You can set Reading Interval and data saving
interval per read commnand in 'Reading Interval' and 'Each
Data Saving Interval'.
And insert your Service Key authenticated from the editer in 'Service Key' . (ref: https://www.data.go.kr/tcs/dss/selectApiDataDetailView.do?publicDataPk=15073861)
![]() |
<Figure 3> Example of Air Pollution Data Reading Service communication driver¡¯s read schedule Add/Edit dialogue box |
When you click Add button or Edit button in dialogue box of <Figure 2>, dialogue box of <Figure 3> is shown.
You can set Air Pollution Data Reading Service by using write settings.
Digital write
Digital write and analog write have the same setting parameters except output value(0 or 1).
Analog write
Analog write setting parameters are as follows:
1) Port Port no. (0 ~ 255)
2) Station don't care.
3) Address Saving start address of Communication Server.
4) Extra1 Write Reading Point name in Korean designated in Air Quality data service.
5) Extra2 The number of data to read at a time.(1 ~ 100).
Write example 1)
PORT : 0 STATION : 0 ADDRESS : 0000 EXTRA1 : »ó´ë¿øµ¿ EXTRA2 : 10
The setting parameter shown above is an example of read command to read real time air pollution information data. Readed 10 data of "»ó´ë¿øµ¿" save at 0 WORD, DWORD, FLOAT memory.